package com.basics.common.utils;

import java.util.*;

public class RandomUtils {

    public static String romNumber(){
        Random ne=new Random();
        String  x =String.valueOf(ne.nextInt(999999));
        if(x.length()<6){
            for(int a =0 ;a<(6-x.length());a++){
                x= "0"+x;
            }
        }
        return x;
    }

    public static Set<String> createCommandList(int len){
        Set<String> list = new HashSet<>();
        for(int a=0;a<len;a++){
            list.add(romNumber());
        }
        return list;
    }

    public static String phoneCodeNumber(){
        Random ne=new Random();
        String  x =String.valueOf(100000+ne.nextInt(899999));
        return x;
    }
    public static String generateRandomCode(int length) {
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        String characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
        int charactersLength = characters.length();
        for (int i = 0; i < length; i++) {
            int randomIndex = random.nextInt(charactersLength);
            char randomChar = characters.charAt(randomIndex);
            sb.append(randomChar);
        }
        return sb.toString();
    }

}
